package io.demo.message.util;

import io.demo.message.domain.Country;
import java.util.Collections;
import java.util.function.Supplier;
import org.apache.commons.lang3.RandomUtils;

public class RandomCountrySupplier implements Supplier<Country> {

  private RandomStringBuilder randomStringBuilder;

  public RandomCountrySupplier() {
    this.randomStringBuilder = RandomStringBuilder.newBuilder()
        .useLowerCase()
        .useUpperCase()
        .useWhitespace();
  }

  @Override
  public Country get() {
    return Country.builder()
        .id(RandomUtils.nextLong())
        .name(randomStringBuilder.build(10, 30))
        .capitalCity(TestingModels.city())
        .ethnics(Collections.singletonList(TestingModels.ethnic()))
        .build();
  }
}
